using System.Diagnostics;
using System;

namespace Game.Tools
{
    public static class PerformanceTestTool
    {
        public static PerformanceData Execute(Action action, int runCount)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            for (int i = 0; i < runCount; i++)
            {
                action();
            }
            sw.Stop();
            return new PerformanceData()
            {
                TotalMilliseconds = sw.ElapsedMilliseconds,
                MeanMilliseconds = sw.ElapsedMilliseconds / runCount
            };
        }
    }

    public class PerformanceData
    {
        public long TotalMilliseconds { get; set; }
        public long MeanMilliseconds { get; set; }
    }
}